package com.WaVel.mapper;

import com.Emplyment.entity.Advertisement;
import com.Emplyment.enumeration.OperationType;
import com.Emplyment.vo.AdvertisementVo;
import com.WaVel.annotation.AutoFill;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AdvertisementMapper {

    @Select("SELECT * FROM advertisement ORDER BY id ASC limit 6")
    List<AdvertisementVo> getAdvertisement();

    @AutoFill(value = OperationType.INSERT)
    void insertAdvertisement(Advertisement advertisement);

    @AutoFill(value = OperationType.UPDATE)
    void updateAdvertisement(Advertisement advertisement);

    @Delete("DELETE FROM advertisement WHERE id = #{id}")
    void deleteAdvertisement(Integer id);
}
